package com.rwx.reflect;

import com.rwx.reflect.model.Student;

import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class Reflect06 {

    public static void main(String[] args) throws ClassNotFoundException,
            NoSuchMethodException,
            InvocationTargetException,
            InstantiationException, IllegalAccessException, NoSuchFieldException {



        Class clazz=Class.forName("com.rwx.reflect.model.Student");
        Constructor con1 = clazz.getConstructor();

        Method[] methods = clazz.getMethods();
        for (Method m:methods){
            System.out.println(m);
        }
        System.out.println("=============================");

        Method[] methods1 = clazz.getDeclaredMethods();
        for (Method m:methods1){
            System.out.println(m);
        }
        System.out.println("=============================");
        Method method2 = clazz.getMethod("getStuInfo", String.class);
        System.out.println(method2);
        System.out.println("=============================");
        Method method3 = clazz.getMethod("getInfo");
        System.out.println(method3);
        System.out.println("=============================");
        Method method4 = clazz.getDeclaredMethod("showStu");
        System.out.println(method4);
        System.out.println("=============================");
    }
}
